package com.jiazhong.basic.pack0316.thread;

import java.util.concurrent.Callable;

// 第三种实现方式，任务 特点：有返回结果
public class DemoD implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        int sum = 0;
        String name = Thread.currentThread().getName();
        for (int i = 1; i < 101; i++) {
            System.out.println(name + "输出了：" + i);
            sum += i;
        }
        return sum;
    }
}
